﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using EntityModels;

using DataAccessLayer;

namespace BusinessLayer
{
    class UserControl
    {
        public bool RegisterUser(User us)
        {
            return DataAccess.Instance.AddUser(us);                              
        }

        public bool LogIn(User us)
        {
           return DataAccess.Instance.LogIn(us);
          
        }

        
        public bool Update(User user)
        {
          if (user.idmember == null) { throw new Exception("Failure with the ID of the user"); }
          return DataAccess.Instance.UpdateUser(user); 
           
        }

        public User GetUser(int id)
        {
            if (id == null) { throw new Exception("Failure with the ID of the user"); }
            return DataAccess.Instance.GetUser(id);

        }

        public User GetUser(String username)
        {
            if (username == null) { throw new Exception("Failure with the ID of the user"); }
            return DataAccess.Instance.GetUser(username);
            
        }

        public List<User> GetUsers(Event ev, Byte b) {
            if (ev.idevent == null) { throw new Exception("Failure with the ID of the event"); }
            return DataAccess.Instance.GetUsers(ev,b);      
           
        }

        public bool UserExists(User us)
        {
            if (us.username == null) { throw new Exception("Failure with the Username of the user"); }
            return DataAccess.Instance.UserExists(us);      
          
        }
    }
}
